package edu.zjut;

public class VariableParameter {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		System.out.println(add(2,4));
		System.out.println(add(2,4,5));
		System.out.println(add(2,4,6,7));
	}
	
	public static int add(int x,int... args){
		int sum =0;
		for(int arg:args){
			sum += arg;
		}
		
		sum += x;
		return sum;
	}
}
